package com.odaqiang.testsn.controller;

import com.odaqiang.testsn.domain.Sn;
import com.odaqiang.testsn.service.ISnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/index")
public class IndexController {
    @Autowired
    private ISnService iSnService;

    /**
     * 获取编号
     *
     * @param type 类型 APP | STORAGE
     * @return
     */
    @GetMapping("/get_sn/{type}")
    public String getSn(@PathVariable("type") String type) {
        return iSnService.generate(Sn.Type.valueOf(type));
    }
}
